1. Field of the Invention
The present invention relates to a numerical controller for controlling machine tools and various types of industrial machines, and more particularly to a numerical controller for performing superposing control in which a motion command for a master axis is superposed on a motion command for a slave axis.
2. Description of Related Art
Control in which motion of an axis is superposed on motion of another axis is known as superposing control. Let us suppose that in an example of a machine tool having two control systems, a workpiece 1 fixed to a headstock 2 is machined with a tool TI and a tool TII, as shown in FIG. 1. As the headstock 2 is moved in a ZIm axis direction, the tool TI is moved in an XI axis direction perpendicular to the ZIm axis direction to machine the workpiece 1, and the tool TII is moved in a ZIIs axis direction parallel to the ZIm axis direction and in an XII axis direction perpendicular to the ZIIs axis direction to machine the workpiece 1. Here, the XI axis and the ZIm axis are called as first-system axes and an XI-ZIm coordinate system is called as a workpiece coordinate system for the first-system. Further, the XII axis and the ZIIs axis are called as second-system axes and a XII-ZIIs coordinate system is called as a workpiece coordinate system for the second-system.
In this machining, if the ZIIs axis is moved with the motion of the ZIm axis, the position of the ZIIs axis relative to the workpiece 1 does not change. Hence, when the workpiece 1 is to be machined with the tool TII, a machining program is created on the assumption that motion of the workpiece 1 in the ZIm axis direction is stopped. In actual machining, the ZIIs axis is moved by superposing control in which a motion command for the ZIm axis is added to a motion command for the ZIIs axis. As a result, the tool TII moves and machines the workpiece 1 as instructed by the program. By performing this superposing control, the workpiece 1 can be machined with the XI and ZIm axes and with the XII and ZIIs axes simultaneously. In this superposing control, the ZIm axis is called a master axis while the ZIIs axis is called a slave axis.
An example where the superposing control is performed according to commands of programs will be described.
For example, for the first system, the following program O1000 is conceivable:                O1000;        . . .        . . .        G01 X0 Z0; motion command        G01 X100. Z100.; motion command        . . .        . . .        
For the second system, the following program O2000 is conceivable:                O2000;        . . .        . . .        M80; ZIm-axis and ZIIs-axis superposing control start command        G01 X0 Z0; motion command        G01 X100. Z100.; motion command        . . .        M83; ZIm-axis and ZIIs-axis superposing control terminate command        . . .        . . .In this example, the superposing control start/terminate command are provided in the program O2000 for the second system.        
FIG. 2 is a diagram schematically showing position control by this superposing control. While the superposing control is being performed (in one example, from the time when a superposing control start command is read from a program till the time when a superposing control terminate command is read), a motion amount δzIm based on a motion command (I1) for the master axis ZIm, which is obtained by the numerical controller in each distribution period, is added to a present value register for the master axis ZIm to update the stored coordinate value of the ZIm axis in a workpiece coordinate system for the first-system (I2). The motion amount δzIm is also inputted to a first-system servo processing section (I3). Meanwhile, a motion amount δzIIs based on a motion command (II1) for the slave axis ZIIs is added to a present value register for the slave axis ZIIs to update the stored coordinate value of the ZIIs axis in the workpiece coordinate system for the second system (II2). For the slave axis ZIIs, a motion amount (δzIIs+δzIm) obtained by adding the motion amount δzIm based on the motion command for the master axis ZIm to the motion amount δzIIs based on the motion command for the slave axis ZIIs is inputted to a second-system servo processing section (II3). The above-mentioned superposing control is performed this way. The superposing control like this is already known to the public (see JP 10-27013A, for example). There are such cases that while the above-mentioned superposing control is being performed, over-travelling of the slave axis happens and an alarm is sent out, or a tool or the like moved by the slave axis interferes with another part, due to superposition of a motion command for the master axis on a motion command for the slave axis.
As a way to prevent trouble like this, it is effective to cancel the superposing control in advance when trouble like this is expected. However, when the superposing control is cancelled, a motion command for the master axis is no longer delivered for the slave axis. As a result, recognition of positional relationship between the master axis and the slave axis is lost, and hence recognition of positional relationship between the workpiece, which is moved by the master axis, and the slave axis is lost.
When the superposing control once cancelled is to be restarted in the positional relation before the termination of the superposing control, it is necessary to calculate the positional relationship between the master axis and the slave axis again and set a slave-axis workpiece coordinate system on the basis of the obtained positional relationship, again. This however requires complicated calculations on the basis of various kinds of machine and workpiece data such as the workpiece coordinate value of the master axis and the workpiece coordinate value of the slave axis at the time the superposing control was cancelled and is to be start again. It is very difficult for an operator to perform the required calculations.